If it comes to home defense, and you have other people living in your home, a shotgun or up to a 9mm (which now come in rifle form too) should do well, they're easier to shoot and wield around corners than a large AR. Anything large like an AR, but especially the heavier grain bullets will over-penetrate in CQB and may hurt others.
A .22 may be too small though to stop anyone, they can kill but most likely hurt a lot and don't necessarily do damage if you hit someone in the human armor plate that is the chest. Depends on the types of criminals you have coming in, most will run away in case of any danger, including a 22LR but it doesn't have stopping power if you have a quarterback-sized druggie charging at you.
You also don't need a large .50 Magnum Desert Eagle or so for the same reasons, besides it being hard to aim and carry being so heavy. You'll blow someone's head clear off, leave a huge hole in every wall, including your neighbors' and probably shatter all the windows.
I've settled myself on a 9mm Ruger PC Carbine for home defense. It's easy to take down, small and relatively light. My wife is getting her permit for a 9mm or smaller caliber concealed carry so magazines are interchangeable. I live in a state where the cops are likely being defunded and the city is getting worse as the BLM mayor refuses to let police clean the neighborhoods. We used to have a Republican mayor up until about a decade ago, home values have since stagnated and the black neighborhoods that were being repaired are now becoming no-go zones again. 2h for a police response is now normal.